from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
from six.moves import urllib
import tensorflow as tf
layers = tf.keras.layers.Dense()

print("tf.VERSION = {}".format(tf.VERSION))
print("tf.keras.__version__ = {}".format(tf.keras.__version__))

from datasets import datasets_utils

_FILE_PATTERN = '%s-*'

_SPLITS_TO_SIZES = {
    'train': 1281167,
    'validation': 50000,
}

_ITEMS_TO_DESCRIPTIONS = {
    'image': 'A color image of varying height and width.',
    'label': 'The label id of the image, integer between 0 and 999',
    'label_text': 'The text of the label.',
    'object/bbox': 'A list of bounding boxes.',
    'object/label': 'A list of labels, one per each object.',
}

_NUM_CLASSES = 1001


def downloadImageNet():
    base_url = 'http://www.image-net.org/challenges/LSVRC/2012/nnoupb/'
    local_url = '../data/'
    train12 = '{}/ILSVRC2012_img_train.tar'
    train3 = '{}/ILSVRC2012_img_train_t3.tar'
    validation = '{}/ILSVRC2012_img_val.tar'
    test = '{}/ILSVRC2012_img_test.tar'
    bounding_box12 = '{}/ILSVRC2012_bbox_train_v2.tar.gz'
    bounding_box3 = '{}/ILSVRC2012_bbox_train_dogs.tar.gz'
    validation_box = '{}/ILSVRC2012_bbox_val_v3.tgz'
    test_box = '{}/ILSVRC2012_bbox_test_dogs.zip'
    download_address = [train3, bounding_box3, validation_box, test_box, ]
    for address in download_address:
        filename, _ = urllib.request.urlretrieve(address.format(base_url), address.format(local_url))
        print(filename)


downloadImageNet()
